package com.xiaochong.tir.api.controller;

import com.xc.logclient.utils.LogTrace;
import com.xiaochong.tir.api.service.ExchangeInfoService;
import com.xiaochong.tir.api.util.ApiVersion;
import com.xiaochong.tir.common.data.mapper.ExchangeInfoMapper;
import com.xiaochong.tir.common.data.po.*;
import com.xiaochong.tir.common.data.vo.ApiResultVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 通证指数
 * @author MengXiangDong
 */
@RestController
@Api(value = "研报")
@RequestMapping(value =ApiVersion.API_V1_PREFIX+"/exchange")
public class ReportController {

	@Autowired
	private ExchangeInfoService exchangeInfoService;


	/**
	 * 研报列表
	 */
	@ApiOperation(value = "研报列表" , notes = "研报列表")
	@GetMapping("reportList")
	public ApiResultVo<List<SyRotationMap>> reportList() {
		LogTrace.info("研报列表", "开始执行reportList研报列表接口",null);
		ApiResultVo api=exchangeInfoService.reportList();
		return api;
	}

	/**
	 *   研报浏览排行列表
	 */
	@ApiOperation(value = "研报浏览排行列表" , notes = "研报浏览排行列表")
	@GetMapping("reportRankList")
	public ApiResultVo<List<SyRotationMap>> reportRankList() {
		LogTrace.info("研报浏览排行列表", "开始执行reportRankList研报浏览排行列表接口",null);
		ApiResultVo api=exchangeInfoService.reportTourRankList();
		return api;
	}

	/**
	 *   研报下载排行列表
	 */
	@ApiOperation(value = "研报下载排行列表" , notes = "研报下载排行列表")
	@GetMapping("reportDownloadRankList")
	public ApiResultVo<List<SyRotationMap>> reportDownloadRankList() {
		LogTrace.info("研报下载排行列表", "开始执行reportDownloadRankList研报下载排行列表接口",null);
		ApiResultVo api=exchangeInfoService.reportDownloadRankList();
		return api;
	}

	/**
	 * 研报详情
	 */
	@ApiOperation(value = "研报详情" , notes = "研报详情（参数id）")
	@PostMapping("reportDetails")
	public ApiResultVo<List<SyRotationMap>> reportDetails(@RequestBody SyResearchReport syResearchReport) {
		LogTrace.info("研报详情", "开始执行reportDetails研报详情接口，参数id"+syResearchReport.getId(),null);
		ApiResultVo api=exchangeInfoService.reportDetails(syResearchReport);
		return api;
	}

	/**
	 * 研报下载
	 */
	@ApiOperation(value = "研报下载" , notes = "研报下载（参数id）")
	@PostMapping("reportDownload")
	public ApiResultVo<List<SyRotationMap>> reportDownload(@RequestBody SyResearchReportFile syResearchReportFile) {
		LogTrace.info("研报下载", "开始执行reportDownload研报下载接口，参数id"+syResearchReportFile.getId(),null);
		ApiResultVo api=exchangeInfoService.reportDownload(syResearchReportFile);
		return api;
	}

	/**
	 * 研报推荐
	 */
	@ApiOperation(value = "研报推荐" , notes = "研报推荐")
	@PostMapping("recommend")
	public ApiResultVo<List<SyRotationMap>> recommend() {
		LogTrace.info("研报推荐", "开始执行recommend研报推荐接口",null);
		ApiResultVo api=exchangeInfoService.recommend();
		return api;
	}

	/**
	 * 研报banner图
	 */
	@ApiOperation(value = "研报banner图" , notes = "研报banner图")
	@PostMapping("bannerList")
	public ApiResultVo<List<SyRotationMap>> bannerList() {
		LogTrace.info("研报banner图", "开始执行bannerList研报banner图接口",null);
		ApiResultVo api=exchangeInfoService.bannerList();
		return api;
	}

}
